import java.io.IOException;
import java.net.Socket;
import java.util.Map;

public class AliveComfirm implements Runnable{
    private Socket socket;

    private static Map<String, Socket> socketMap;
    public AliveComfirm(Socket socket){
        this.socket=socket;

    }

    @Override
    public void run() {
        try {
            while (true) {
                //发送心跳包, 确认客户端是否存活
                socket.sendUrgentData(0xFF); // 发送心跳包
                //15s 一次
                Thread.sleep(1000);
            }

        } catch (IOException | InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
